Processor to execute shift right merge instructions

ABSTRACT

Method, apparatus, and program means for performing bitstream buffer manipulation with a SIMD merge instruction. The method of one embodiment comprises determining whether any unprocessed data bits for a partial variable length symbol exist in a first data block is made. A shift merge operation is performed to merge the unprocessed data bits from the first data block with a second data block. A merged data block is formed. A merged variable length symbol comprised of the unprocessed data bits and a plurality of data bits from the second data block is extracted from the merged data block.

RELATED APPLICATIONS

The present application is a continuation of U.S. patent applicationSer. No. 12/907,843, filed on Oct. 19, 2010, entitled “Bitstream BufferManipulation with a SIMD Merge Instruction”. U.S. patent applicationSer. No. 12/907,843 is a continuation of U.S. patent application Ser.No. 10/612,542, filed on Jul. 1, 2003, entitled “Bitstream BufferManipulation with a SIMD Merge Instruction,” now U.S. Pat. No.7,818,356. The U.S. patent application Ser. No. 10/612,542 is herebyincorporated herein by this reference. U.S. patent application Ser. No.10/612,542 is itself a Continuation In Part of U.S. application Ser. No.10/280,511, entitled “Method and Apparatus for Parallel Shift RightMerge of Data”, filed on Oct. 25, 2002, now U.S. Pat. No. 7,272,622,which is itself a Continuation In Part of U.S. patent application Ser.No. 09/952,891, entitled “An Apparatus and Method for EfficientFiltering and Convolution of Content Data”, filed Oct. 29, 2001, nowU.S. Pat. No. 7,085,795.

BACKGROUND

1. Field of the Invention

The present disclosure pertains to the field of processing apparatusesand associated software sequences and software sequences that performmathematical operations.

2. Description of Related Art

As processor technology advances, newer software code is also beinggenerated to run machines with these processors. Users generally expectand demand higher performance from their computers regardless of thetype of software being used. One such issue can arise from the kinds ofinstructions and operations that are actually being performed within theprocessor. Certain types of operations require more time to completebased on the complexity of the operations and/or type of circuitryneeded. This provides an opportunity to optimize the way certain complexoperations are executed inside the processor.

The display of images, as well as playback of audio and video data,which is collectively referred to as content, have become increasinglypopular applications for current computing devices. Filtering andconvolution operations are some of the most common operations performedon content data, such as image audio and video data. Such operations arecomputationally intensive, but offer a high level of data parallelismthat can be exploited through an efficient implementation using variousdata storage devices, for example, single instruction multiple data(SIMD) registers. A number of current architectures also requireunnecessary data type changes which minimizes instruction throughput andsignificantly increases the number of clock cycles required to orderdata for arithmetic operations.

In communicating various types of data, especially for audio/video,compression and encoding is heavily used to reduce the enormous amountof data to something more manageable. If the code is comprised of fixedlength pieces, an algorithm for decoding and handling the code can beoptimized as the code pieces are predictable. However, with variablelength codes, the situation is more complex. The code for each symbolhas to be properly recognized and decoded. Additional complexities arealso introduced with variable length codes due to the bit granularity ofsymbols and the large possibility that these symbols do not align with amore manageable byte boundary.

BRIEF DESCRIPTION OF THE FIGURES

The present invention is illustrated by way of example and notlimitation in the Figures of the accompanying drawings, in which likereferences indicate similar elements.

FIG. 1A is a block diagram of a computer system formed with a processorthat includes execution units to execute a SIMD instruction for aparallel shift merge operation in accordance with one embodiment of thepresent invention;

FIG. 1B is a block diagram of another exemplary computer system inaccordance with an alternative embodiment of the present invention;

FIG. 1C is a block diagram of yet another exemplary computer system inaccordance with another alternative embodiment of the present invention;

FIG. 2 is a block diagram of the micro-architecture for a processor ofone embodiment that includes logic circuits to perform shift mergeoperations in accordance with the present invention;

FIG. 3A illustrates various packed data type representations inmultimedia registers according to one embodiment of the presentinvention;

FIG. 3B illustrates packed data-types in accordance with an alternativeembodiment;

FIG. 3C illustrates one embodiment of an operation encoding (opcode)format;

FIG. 3D illustrates an alternative operation encoding (opcode) format;

FIG. 3E illustrates yet another alternative operation encoding format;

FIG. 4A is a block diagram of one embodiment of logic to perform a SIMDparallel shift merge operation on data operands in accordance with thepresent invention;

FIG. 4B is a block diagram of another embodiment of logic to perform ashift right merge operation;

FIG. 5A illustrates the operation of a parallel shift merge instructionin accordance with a first embodiment of the present invention;

FIG. 5B illustrates the operation of a shift right merge instruction inaccordance with a second embodiment;

FIG. 6A is a flowchart illustrating one embodiment of a method to shiftand merge data operands;

FIG. 6B is a flowchart illustrating another embodiment of a method toshift right and merge data;

FIG. 7A illustrates an operation for a bitstream buffer manipulationwith a SIMD merge instruction in accordance with one embodiment of thepresent invention;

FIG. 7B further illustrates the operation from FIG. 7A for a bitstreambuffer manipulation in accordance with the present invention; and

FIGS. 8A-C are flowcharts illustrating one embodiment of a method tomanipulate a bitstream buffer with a SIMD merge instruction.

DETAILED DESCRIPTION

The following description describes embodiments of a method forbitstream buffer manipulation with a SIMD merge instruction. In thefollowing description, numerous specific details such as processortypes, micro-architectural conditions, events, enablement mechanisms,and the like are set forth in order to provide a more thoroughunderstanding of the present invention. It will be appreciated, however,by one skilled in the art that the invention may be practiced withoutsuch specific details. Additionally, some well known structures,circuits, and the like have not been shown in detail to avoidunnecessarily obscuring the present invention.

Although the following embodiments are described with reference to aprocessor, other embodiments are applicable to other types of integratedcircuits and logic devices. The same techniques and teachings of thepresent invention can easily be applied to other types of circuits orsemiconductor devices that can benefit from higher pipeline throughputand improved performance. The teachings of the present invention areapplicable to any processor or machine that performs data manipulations.Moreover, the present invention is not limited to processors or machinesthat perform 256 bit, 128 bit, 64 bit, 32 bit, or 16 bit data operationsand can be applied to any processor and machine in which manipulation ofpacked data is needed.

In the following description, for purposes of explanation, numerousspecific details are set forth in order to provide a thoroughunderstanding of the present invention. One of ordinary skill in theart, however, will appreciate that these specific details are notnecessary in order to practice the present invention. In addition, thefollowing description provides examples, and the accompanying drawingsshow various examples for the purposes of illustration. However, theseexamples should not be construed in a limiting sense as they are merelyintended to provide examples of the present invention rather than toprovide an exhaustive list of all possible implementations of thepresent invention.

Although the below examples describe instruction handling anddistribution in the context of execution units and logic circuits, otherembodiments of the present invention can be accomplished by way ofsoftware. In one embodiment, the methods of the present invention areembodied in machine-executable instructions. The instructions can beused to cause a general-purpose or special-purpose processor that isprogrammed with the instructions to perform the steps of the presentinvention. The present invention may be provided as a computer programproduct or software which may include a machine or computer-readablemedium having stored thereon instructions which may be used to program acomputer (or other electronic devices) to perform a process according tothe present invention. Alternatively, the steps of the present inventionmight be performed by specific hardware components that containhardwired logic for performing the steps, or by any combination ofprogrammed computer components and custom hardware components. Suchsoftware can be stored within a memory in the system. Similarly, thecode can be distributed via a network or by way of other computerreadable media.

Thus a machine-readable medium may include any mechanism for storing ortransmitting information in a form readable by a machine (e.g., acomputer), but is not limited to, floppy diskettes, optical disks,Compact Disc, Read-Only Memory (CD-ROMs), and magneto-optical disks,Read-Only Memory (ROMs), Random Access Memory (RAM), ErasableProgrammable Read-Only Memory (EPROM), Electrically ErasableProgrammable Read-Only Memory (EEPROM), magnetic or optical cards, flashmemory, a transmission over the Internet, electrical, optical,acoustical or other forms of propagated signals (e.g., carrier waves,infrared signals, digital signals, etc.) or the like. Accordingly, thecomputer-readable medium includes any type of media/machine-readablemedium suitable for storing or transmitting electronic instructions orinformation in a form readable by a machine (e.g., a computer).Moreover, the present invention may also be downloaded as a computerprogram product. As such, the program may be transferred from a remotecomputer (e.g., a server) to a requesting computer (e.g., a client). Thetransfer of the program may be by way of electrical, optical,acoustical, or other forms of data signals embodied in a carrier wave orother propagation medium via a communication link (e.g., a modem,network connection or the like).

A design may go through various stages, from creation to simulation tofabrication. Data representing a design may represent the design in anumber of manners. First, as is useful in simulations, the hardware maybe represented using a hardware description language or anotherfunctional description language. Additionally, a circuit level modelwith logic and/or transistor gates may be produced at some stages of thedesign process. Furthermore, most designs, at some stage, reach a levelof data representing the physical placement of various devices in thehardware model. In the case where conventional semiconductor fabricationtechniques are used, data representing a hardware model may be the dataspecifying the presence or absence of various features on different masklayers for masks used to produce the integrated circuit. In anyrepresentation of the design, the data may be stored in any form of amachine readable medium. An optical or electrical wave modulated orotherwise generated to transmit such information, a memory, or amagnetic or optical storage such as a disc may be the machine readablemedium. Any of these mediums may “carry” or “indicate” the design orsoftware information. When an electrical carrier wave indicating orcarrying the code or design is transmitted, to the extent that copying,buffering, or re-transmission of the electrical signal is performed, anew copy is made. Thus, a communication provider or a network providermay make copies of an article (a carrier wave) embodying techniques ofthe present invention.

In modern processors, a number of different execution units are used toprocess and execute a variety of code and instructions. Not allinstructions are created equal as some are quicker to complete whileothers can take an enormous number of clock cycles. The faster thethroughput of instructions, the better the overall performance of theprocessor. Thus it would be advantageous to have as many instructionsexecute as fast as possible. However, there are certain instructionsthat have greater complexity and require more in terms of execution timeand processor resources. For example, there are floating pointinstructions, load/store operations, data moves, etc.

As more and more computer systems are used in interne and multimediaapplications, additional processor support has been introduced overtime. For instance, Single Instruction, Multiple Data (SIMD)integer/floating point instructions and Streaming SIMD Extensions (SSE)are instructions that reduce the overall number of instructions requiredto execute a particular program task. These instructions can speed upsoftware performance by operating on multiple data elements in parallel.As a result, performance gains can be achieved in a wide range ofapplications including video, speech, and image/photo processing. Theimplementation of SIMD instructions in microprocessors and similar typesof logic circuit usually involve a number of issues. Furthermore, thecomplexity of SIMD operations often leads to a need for additionalcircuitry in order to correctly process and manipulate the data.

Applications of coding and decoding operations are found in a widerarray of image and video processing tasks and communications. Oneexample of coding/decoding algorithms is used in processing of MotionPicture Expert Group (MPEG) video. Variable length encoding (VLC) anddecoding (VLD) are used in various compression techniques and standardssuch as JPEG and MPEG. In variable length codes, the different symbolsrequire a different numbers of bits. One operation in variable lengthdecoding is to extract bits out of the bitstream before decoding thesymbols. In order to extract a variable number of bits from thebitstream for a variable length symbol, the beginning of symbols have tobe addressed by bits instead of bytes. However, addressing memory on abit-wise level is difficult, data from the bitstream is sent to atemporary register first. The bits are then shifted around andmanipulated to emulate bit addressability of the bitstream.

Unfortunately, current methods and instructions target the general needsof variable length coding/decoding and are not comprehensive. In fact,many architectures do not support a means for efficient extraction ofvarying length data symbols. In addition, data ordering within datastorage devices such as SIMD registers, as well as a capability ofmerging values in a register and for partial data transfers betweenregisters, are generally not supported. As a result, currentarchitectures require unnecessary data type changes which increases thenumber of clock cycles required to order data for arithmetic operations.A SIMD shift merge instruction can be useful in audio and videoapplications where large amounts of packed data are processed. Forexample, a single shift merge instruction of one embodiment is capableof replacing multiple instructions that would be needed to perform anequivalent data manipulation. By reducing the number of instructionsneeded, throughput can be increased and processing resources such asregisters and execution units freed up.

Presently, a number of instructions are needed in order to perform therequisite data manipulation for extracting symbols. This can beespecially tedious in cases where the symbols are of variable length.The complexity is further increased where the variable lengths are at abit granularity versus a more manageable byte granularity. The use of aSIMD shift merge type of instruction in a VLD algorithm to extractsymbols can help reduce the instruction count and code complexity. Forinstance, one decoding algorithm to generate the same results without aSIMD shift merge instruction uses more instructions that take upadditional processing resources and pipeline slots to perform thefunctionality and work of a single shift merge instruction. As a result,VLD code that does not use a shift merge type of instruction can oftenbe lengthier in terms of code size and slower in terms of execution.Furthermore, memory loads and data dependencies that are present indecoding loops of the VLD algorithms can also gate instructionprocessing as execution resources are stalled until the needed data isavailable. The use of a shift merge instruction can assist in freeing upresources not only by reducing the instruction count, but by simplifyingmemory loads from a data bitstream.

Embodiments of the present invention provide a way to implement abitstream buffer manipulation algorithm that makes use of SIMDinstructions and related hardware. For one embodiment, the followingalgorithm illustrates how to extract n-bits for VLD. Data from abitstream is directed into a temporary register. The correct number ofbits are read out from the register for each symbol extracted. In oneimplementation, the symbol extraction involves copying the n-bits forthe symbol to a general purpose register for further use. Although thevalue n is used here generally, each symbol being extracted can have adifferent number of bits. Thus n can vary from symbol to symbol. For oneembodiment, the algorithm and/or logic scans the symbol properties todetermine the proper value for that current symbol. This extraction cancontinue until less than all of the n-bits needed for the next symbolare available in the register. So when the temporary register has lessthan n-bits, then read m-bits from the bitstream. The value of m is amultiple of eight in this embodiment and a number much larger than n.The newly read m-bits are merged into the temporary register with thebits of interest in the register that are still being processed.Embodiments of the present invention use a shift merge instruction inthe VLD algorithm shift and merge data during management of thebitstream buffers. The n-bits for the next symbol are then from thetemporary register using a bit-wise shift.

FIG. 1A is a block diagram of an exemplary computer system formed with aprocessor that includes execution units to execute an instruction for ashift merge operation in accordance with one embodiment of the presentinvention. System 100 includes a component, such as a processor 102 toemploy execution units including logic to perform algorithms for processdata, in accordance with the present invention, such as in theembodiment described herein. System 100 is representative of processingsystems based on the PENTIUM® III, PENTIUM® 4, Xeon™, Itanium®, XScale™and/or StrongARM™ microprocessors available from Intel Corporation ofSanta Clara, Calif., although other systems (including PCs having othermicroprocessors, engineering workstations, set-top boxes and the like)may also be used. In one embodiment, sample system 100 may execute aversion of the WINDOWS™ operating system available from MicrosoftCorporation of Redmond, Wash., although other operating systems (UNIXand Linux for example), embedded software, and/or graphical userinterfaces, may also be used. Thus, the present invention is not limitedto any specific combination of hardware circuitry and software.

The present enhancement is not limited to computer systems. Alternativeembodiments of the present invention can be used in other devices suchas handheld devices and embedded applications. Some examples of handhelddevices include cellular phones, Internet Protocol devices, digitalcameras, personal digital assistants (PDAs), and handheld PCs. Embeddedapplications can include a micro controller, a digital signal processor(DSP), system on a chip, network computers (NetPC), set-top boxes,network hubs, wide area network (WAN) switches, or any other system thatperforms merge operations on operands. Furthermore, some architectureshave been implemented to enable instructions to operate on several datasimultaneously to improve the efficiency of multimedia applications. Asthe type and volume of data increases, computers and their processorshave to be enhanced to manipulate data in more efficient methods.

FIG. 1A is a block diagram of a computer system 100 formed with aprocessor 102 that includes one or more execution units 108 to performan algorithm to manipulate a bitstream buffer with a SIMD shift mergeinstruction in accordance with the present invention. The presentembodiment is described in the context of a single processor desktop orserver system, but alternative embodiments can be included in amultiprocessor system. System 100 is an example of a hub architecture.The computer system 100 includes a processor 102 to process datasignals. The processor 102 can be a complex instruction set computer(CISC) microprocessor, a reduced instruction set computing (RISC)microprocessor, a very long instruction word (VLIW) microprocessor, aprocessor implementing a combination of instruction sets, or any otherprocessor device, such as a digital signal processor, for example. Theprocessor 102 is coupled to a processor bus 110 that can transmit datasignals between the processor 102 and other components in the system100. The elements of system 100 perform their conventional functions.

In one embodiment, the processor 102 includes a Level 1 (L1) internalcache memory 104. Depending on the architecture, the processor 102 canhave a single internal cache or multiple levels of internal cache.Alternatively, in another embodiment, cache memory can reside externalto the processor 102. Other embodiments can also include a combinationof both internal and external caches depending on the implementation.Register file 106 can store different types of data in various registersincluding integer registers, floating point registers, status registers,and instruction pointer register.

Execution unit 108, including logic to perform integer and floatingpoint operations, also resides in the processor 102. The processor 102also includes a microcode (ucode) ROM that stores microcode for certainmacroinstructions. For this embodiment, execution unit 108 includeslogic to handle a packed instruction set 109. In one embodiment, thepacked instruction set 109 includes a packed parallel shift mergeinstruction for joining together blocks of data. By including the packedinstruction set 109 in the instruction set of a general-purposeprocessor 102, along with associated circuitry to execute theinstructions, the operations used by many multimedia applications may beperformed using packed data in a general-purpose processor 102. Thus,many multimedia applications can be accelerated and executed moreefficiently by using the full width of a processor's data bus forperforming operations on packed data. This can eliminate the need totransfer smaller units of data across the processor's data bus toperform one or more operations one data element at a time. Alternateembodiments of an execution unit 108 can also be used in microcontrollers, embedded processors, graphics devices, DSPs, and othertypes of logic circuits. System 100 includes a memory 120. Memory 120can be a dynamic random access memory (DRAM) device, a static randomaccess memory (SRAM) device, flash memory device, or other memorydevice. Memory 120 can store instructions and/or data represented bydata signals that can be executed by processor 102.

A system logic chip 116 is coupled to the processor bus 110 and memory120. The system logic chip 116 in the illustrated embodiment is a memorycontroller hub (MCH). The processor 102 can communicate to the MCH 116via a processor bus 110. The MCH 116 provides a high bandwidth memorypath 118 to memory 120 for instruction and data storage and for storageof graphics commands, data and textures. The MCH 116 is to direct datasignals between the processor 102, memory 120, and other components inthe system 100 and to bridge the data signals between processor bus 110,memory 120, and system I/O 122. In some embodiments, the system logicchip 116 can provide a graphics port for coupling to a graphicscontroller 112. The MCH 116 is coupled to memory 120 through a memoryinterface 118. The graphics card 112 is coupled to the MCH 116 throughan Accelerated Graphics Port (AGP) interconnect 114.

System 100 uses a proprietary hub interface bus 122 to couple the MCH116 to the I/O controller hub (ICH) 130. The ICH 130 provides directconnections to some I/O devices via a local I/O bus. The local I/O busis a high-speed I/O bus for connecting peripherals to the memory 120,chipset, and processor 102. Some examples are the audio controller,firmware hub (flash BIOS) 128, wireless transceiver 126, data storage124, legacy I/O controller containing user input and keyboardinterfaces, a serial expansion port such as Universal Serial Bus (USB),and a network controller 134. The data storage device 124 can comprise ahard disk drive, a floppy disk drive, a CD-ROM device, a flash memorydevice, or other mass storage device.

For another embodiment of a system, an execution unit to execute a shiftmerge instruction can be used with a system on a chip. One embodiment ofa system on a chip comprises of a processor and a memory. The memory forone such system is a flash memory. The flash memory can be located onthe same die as the processor and other system components. Additionally,other logic blocks such as a memory controller or graphics controllercan also be located on a system on a chip.

FIG. 1B illustrates an alternative embodiment of a data processingsystem 140 which implements the principles of the present invention. Oneembodiment of data processing system 140 is an Intel® Personal InternetClient Architecture (Intel® PCA) applications processors with IntelXScale™ technology (as described on the world-wide web atdeveloper.intel.com). It will be readily appreciated by one of skill inthe art that the embodiments described herein can be used withalternative processing systems without departure from the scope of theinvention.

Computer system 140 comprises a processing core 159 capable ofperforming SIMD operations including a shift merge. For one embodiment,processing core 159 represents a processing unit of any type ofarchitecture, including but not limited to a CISC, a RISC or a VLIW typearchitecture. Processing core 159 may also be suitable for manufacturein one or more process technologies and by being represented on amachine readable media in sufficient detail, may be suitable tofacilitate said manufacture.

Processing core 159 comprises an execution unit 142, a set of registerfile(s) 145, and a decoder 144. Processing core 159 also includesadditional circuitry (not shown) which is not necessary to theunderstanding of the present invention. Execution unit 142 is used forexecuting instructions received by processing core 159. In addition torecognizing typical processor instructions, execution unit 142 canrecognize instructions in packed instruction set 143 for performingoperations on packed data formats. Packed instruction set 143 includesinstructions for supporting data merge operations, and may also includeother packed instructions. Execution unit 142 is coupled to registerfile 145 by an internal bus. Register file 145 represents a storage areaon processing core 159 for storing information, including data. Aspreviously mentioned, it is understood that the storage area used forstoring the packed data is not critical. Execution unit 142 is coupledto decoder 144. Decoder 144 is used for decoding instructions receivedby processing core 159 into control signals and/or microcode entrypoints. In response to these control signals and/or microcode entrypoints, execution unit 142 performs the appropriate operations.

Processing core 159 is coupled with bus 141 for communicating withvarious other system devices, which may include but are not limited to,for example, synchronous dynamic random access memory (SDRAM) control146, static random access memory (SRAM) control 147, burst flash memoryinterface 148, personal computer memory card international association(PCMCIA)/compact flash (CF) card control 149, liquid crystal display(LCD) control 150, direct memory access (DMA) controller 151, andalternative bus master interface 152. In one embodiment, data processingsystem 140 may also comprise an I/O bridge 154 for communicating withvarious I/O devices via an I/O bus 153. Such I/O devices may include butare not limited to, for example, universal asynchronousreceiver/transmitter (UART) 155, universal serial bus (USB) 156,Bluetooth wireless UART 157 and I/O expansion interface 158.

One embodiment of data processing system 140 provides for mobile,network and/or wireless communications and a processing core 159 capableof performing SIMD operations including a shift merge operation.Processing core 159 may be programmed with various audio, video, imagingand communications algorithms including discrete transformations such asa Walsh-Hadamard transform, a fast Fourier transform (FFT), a discretecosine transform (DCT), and their respective inverse transforms;compression/decompression techniques such as color space transformation,video encode motion estimation or video decode motion compensation; andmodulation/demodulation (MODEM) functions such as pulse coded modulation(PCM).

FIG. 1C illustrates yet alternative embodiments of a data processingsystem capable of performing SIMD shift merge operations. In accordancewith one alternative embodiment, data processing system 160 may includea main processor 166, a SIMD coprocessor 161, a cache memory 167, and aninput/output system 168. The input/output system 168 may optionally becoupled to a wireless interface 169. SIMD coprocessor 161 is capable ofperforming SIMD operations including data merges. Processing core 170may be suitable for manufacture in one or more process technologies andby being represented on a machine readable media in sufficient detail,may be suitable to facilitate the manufacture of all or part of dataprocessing system 160 including processing core 170.

For one embodiment, SIMD coprocessor 161 comprises an execution unit 162and a set of register file(s) 164. One embodiment of main processor 165comprises a decoder 165 to recognize instructions of instruction set 163including SIMD shift merge instructions for execution by execution unit162. For alternative embodiments, SIMD coprocessor 161 also comprises atleast part of decoder 165B to decode instructions of instruction set163. Processing core 170 also includes additional circuitry (not shown)which is not necessary to the understanding of the present invention.

In operation, the main processor 166 executes a stream of dataprocessing instructions that control data processing operations of ageneral type including interactions with the cache memory 167, and theinput/output system 168. Embedded within the stream of data processinginstructions are SIMD coprocessor instructions. The decoder 165 of mainprocessor 166 recognizes these SIMD coprocessor instructions as being ofa type that should be executed by an attached SIMD coprocessor 161.Accordingly, the main processor 166 issues these SIMD coprocessorinstructions (or control signals representing SIMD coprocessorinstructions) on the coprocessor bus 166 where from they are received byany attached SIMD coprocessors. In this case, the SIMD coprocessor 161will accept and execute any received SIMD coprocessor instructionsintended for it.

Data may be received via wireless interface 169 for processing by theSIMD coprocessor instructions. For one example, voice communication maybe received in the form of a digital signal, which may be processed bythe SIMD coprocessor instructions to regenerate digital audio samplesrepresentative of the voice communications. For another example,compressed audio and/or video may be received in the form of a digitalbit stream, which may be processed by the SIMD coprocessor instructionsto regenerate digital audio samples and/or motion video frames. For oneembodiment of processing core 170, main processor 166, and a SIMDcoprocessor 161 are integrated into a single processing core 170comprising an execution unit 162, a set of register file(s) 164, and adecoder 165 to recognize instructions of instruction set 163 includingSIMD merge instructions.

FIG. 2 is a block diagram of the micro-architecture for a processor 200of one embodiment that includes logic circuits to perform a shift mergeoperation in accordance with the present invention. The shift rightmerge operation may also be referred to as a register merge operationand register merge instruction. For one embodiment of the shift mergeinstruction, the instruction can take data from the two memory blocks,shift one or more data elements out of one block, and append/merge thesame number of shifted data elements from the other block to the firstblock to generate a resultant merged data block. The shift mergeinstruction can also be referred to as PSRMRG or packed shift merge orparallel shift merge. In this embodiment, the shift merge instructioncan also be implemented to operate on data elements having sizes ofbyte, word, doubleword, quadword, etc. The in-order front end 201 is thepart of the processor 200 that fetches the macro-instructions to beexecuted and prepares them to be used later in the processor pipeline.The front end 201 of this embodiment includes several units. Theinstruction prefetcher 226 fetches macro-instructions from memory andfeeds them to an instruction decoder 228 which in turn decodes them intoprimitives called micro-instructions or micro-operations (also calledmicro op or uops) that the machine knows how to execute. The trace cache230 takes decoded uops and assembles them into program ordered sequencesor traces in the uop queue 234 for execution. When the trace cache 230encounters a complex macro-instruction, microcode ROM 232 provides uopsneeded to complete the operation.

Many macro-instructions are converted into a single micro-op, and othersneed several micro-ops to complete the full operation. In thisembodiment, if more than four micro-ops are needed to complete amacro-instruction, the decoder 228 accesses the microcode ROM 232 to dothe macro-instruction. For one embodiment, a shift merge instruction canbe decoded into a small number of micro ops for processing at theinstruction decoder 228. In another embodiment, an instruction for apacked shift merge algorithm can be stored within the microcode ROM 232should a number of micro-ops be needed to accomplish the operation. Thetrace cache 230 refers to an entry point programmable logic array (PLA)to determine a correct micro-instruction pointer for reading micro-codesequences for merge algorithms in the micro-code ROM 232. After themicrocode ROM 232 finishes sequencing micro-ops for the currentmacro-instruction, the front end 201 of the machine resumes fetchingmicro-ops from the trace cache 230.

Some SIMD and other multimedia types of instructions are consideredcomplex instructions. Most floating point related instructions are alsocomplex instructions. As such, when the instruction decoder 228encounters a complex macro-instruction, the microcode ROM 232 isaccessed at the appropriate location to retrieve the microcode sequencefor that macro-instruction. The various micro-ops needed for performingthat macro-instruction are communicated to the out-of-order executionengine 203 for execution at the appropriate integer and floating pointexecution units.

The out-of-order execution engine 203 is where the micro-instructionsare prepared for execution. The out-of-order execution logic has anumber of buffers to smooth out and re-order the flow ofmicro-instructions to optimize performance as they go down the pipelineand get scheduled for execution. The allocator logic allocates themachine buffers and resources that each uop needs in order to execute.The register renaming logic renames logic registers onto entries in aregister file. The allocator also allocates an entry for each uop in oneof the two uop queues, one for memory operations and one for non-memoryoperations, in front of the instruction schedulers: memory scheduler,fast scheduler 202, slow/general floating point scheduler 204, andsimple floating point scheduler 206. The uop schedulers 202, 204, 206,determine when a uop is ready to execute based on the readiness of theirdependent input register operand sources and the availability of theexecution resources the uops need to complete their operation. The fastscheduler 202 of this embodiment can schedule on each half of the mainclock cycle while the other schedulers can only schedule once per mainprocessor clock cycle. The schedulers arbitrate for the dispatch portsto schedule uops for execution.

Register files 208, 210, sit between the schedulers 202, 204, 206, andthe execution units 212, 214, 216, 218, 220, 222, 224 in the executionblock 211. There is a separate register file 208, 210, for integer andfloating point operations, respectively. Each register file 208, 210, ofthis embodiment also includes a bypass network that can bypass orforward just completed results that have not yet been written into theregister file to new dependent uops. The integer register file 208 andthe floating point register file 210 are also capable of communicatingdata with the other. For one embodiment, the integer register file 208is split into two separate register files, one register file for the loworder 32 bits of data and a second register file for the high order 32bits of data. The floating point register file 210 of one embodiment has128 bit wide entries because floating point instructions typically haveoperands from 64 to 128 bits in width.

The execution block 211 contains the execution units 212, 214, 216, 218,220, 222, 224, where the instructions are actually executed. Thissection includes the register files 208, 210, that store the integer andfloating point data operand values that the micro-instructions need toexecute. The processor 200 of this embodiment is comprised of a numberof execution units: address generation unit (AGU) 212, AGU 214, fast ALU216, fast ALU 218, slow ALU 220, floating point ALU 222, floating pointmove unit 224. For this embodiment, the floating point execution blocks222, 224, execute floating point, MMX, SIMD, and SSE operations. Thefloating point ALU 222 of this embodiment includes a 64 bit by 64 bitfloating point divider to execute divide, square root, and remaindermicro-ops. For embodiments of the present invention, any act involving afloating point value occurs with the floating point hardware. Forexample, conversions between integer format and floating point formatinvolve a floating point register file. Similarly, a floating pointdivide operation happens at a floating point divider. On the other hand,non-floating point numbers and integer type are handled with integerhardware resources. The simple, very frequent ALU operations go to thehigh-speed ALU execution units 216, 218. The fast ALUs 216, 218, of thisembodiment can execute fast operations with an effective latency of halfa clock cycle. For one embodiment, most complex integer operations go tothe slow ALU 220 as the slow ALU 220 includes integer execution hardwarefor long latency type of operations, such as a multiplier, shifts, flaglogic, and branch processing. Memory load/store operations are executedby the AGUs 212, 214. For this embodiment, the integer ALUs 216, 218,220, are described in the context of performing integer operations on 64bit data operands. In alternative embodiments, the ALUs 216, 218, 220,can be implemented to support a variety of data bits including 16, 32,128, 256, etc. Similarly, the floating point units 222, 224, can beimplemented to support a range of operands having bits of variouswidths. For one embodiment, the floating point units 222, 224, canoperate on 128 bits wide packed data operands in conjunction with SIMDand multimedia instructions.

In this embodiment, the uops schedulers 202, 204, 206, dispatchdependent operations before the parent load has finished executing. Asuops are speculatively scheduled and executed in processor 200, theprocessor 200 also includes logic to handle memory misses. If a dataload misses in the data cache, there can be dependent operations inflight in the pipeline that have left the scheduler with temporarilyincorrect data. A replay mechanism tracks and re-executes instructionsthat use incorrect data. Only the dependent operations need to bereplayed. The independent ones are allowed to complete.

The term “registers” is used herein to refer to the on-board processorstorage locations that are used as part of macro-instructions toidentify operands. In other words, the registers referred to herein arethose that are visible from the outside of the processor (from aprogrammer's perspective). However, the registers of an embodimentshould not be limited in meaning to a particular type of circuit.Rather, a register of an embodiment need only be capable of storing andproviding data, and performing the functions described herein. Theregisters described herein can be implemented by circuitry within aprocessor using any number of different techniques, such as dedicatedphysical registers, dynamically allocated physical registers usingregister renaming, combinations of dedicated and dynamically allocatedphysical registers, etc. In one embodiment, integer registers storethirty-two bit integer data. A register file of one embodiment alsocontains eight multimedia SIMD registers for packed data. For thediscussions below, the registers are understood to be data registersdesigned to hold packed data, such as 64 bits wide MMX™ registers (alsoreferred to as ‘mm’ registers in some instances) in microprocessorsenabled with MMX technology from Intel Corporation of Santa Clara,Calif. These MMX registers, available in both integer and floating pointforms, can operated with packed data elements that accompany SIMD andSSE instructions. Similarly, 128 bits wide XMM registers relating toSSE2 technology can also be used to hold such packed data operands. Inthis embodiment, in storing packed data and integer data, the registersdo not need to differentiate between the two data types.

FIG. 3A illustrates various packed data type representations inmultimedia registers according to one embodiment of the presentinvention. FIG. 3A illustrates data types for a packed byte 310, apacked word 320, and a packed doubleword (dword) 330 for 128 bits wideoperands. The packed byte format 310 of this example is 128 bits longand contains sixteen packed byte data elements. A byte is defined hereas eight bits of data. Information for each byte data element is storedin bit 7 through bit 0 for byte 0, bit 15 through bit 8 for byte 1, bit23 through bit 16 for byte 2, and finally bit 120 through bit 127 forbyte 15. Thus, all available bits are used in the register. This storagearrangement increases the storage efficiency of the processor. As well,with sixteen data elements accessed, one operation can now be performedon sixteen data elements in parallel.

Generally, a data element is an individual piece of data that is storedin a single register or memory location with other data elements of thesame length. In packed data sequences relating to SSE2 technology, thenumber of data elements stored in a XMM register is 128 bits divided bythe length in bits of an individual data element. Similarly, in packeddata sequences relating to MMX and SSE technology, the number of dataelements stored in an MMX register is 64 bits divided by the length inbits of an individual data element. Although the data types illustratedin FIG. 3A are 128 bit long, embodiments of the present invention canalso operate with 64 bit wide or other sized operands. The packed wordformat 320 of this example is 128 bits long and contains eight packedword data elements. Each packed word contains sixteen bits ofinformation. The packed doubleword format 330 of FIG. 3A is 128 bitslong and contains four packed doubleword data elements. Each packeddoubleword element contains thirty two bits of information. A packedquadword is 128 bits long and contains two packed quadword dataelements.

FIG. 3B illustrates alternative in-register data storage formats. Eachpacked data can include more than one independent data element. Threepacked data formats are illustrated; packed half 341, packed single 342,and packed double 343. One embodiment of packed half 341, packed single342, and packed double 343 contain fixed-point data elements. For analternative embodiment one or more of packed half 341, packed single342, and packed double 343 may contain floating-point data elements. Onealternative embodiment of packed half 341 is one hundred twenty-eightbits long containing eight 16-bit data elements. One embodiment ofpacked single 342 is one hundred twenty-eight bits long and containsfour 32-bit data elements. One embodiment of packed double 343 is onehundred twenty-eight bits long and contains two 64-bit data elements. Itwill be appreciated that such packed data formats may be furtherextended to other register lengths, for example, to 96-bits, 160-bits,192-bits, 224-bits, 256-bits or more.

FIG. 3C is a depiction of one embodiment of an operation encoding(opcode) format 360, having thirty-two or more bits, and register/memoryoperand addressing modes corresponding with a type of opcode formatdescribed in the “IA-32 Intel Architecture Software Developer's ManualVolume 2: Instruction Set Reference,” which is which is available fromIntel Corporation, Santa Clara, Calif. on the world-wide-web (www) atintel.com/design/litcentr. The type of shift merge operation, may beencoded by one or more of fields 361 and 362. Up to two operandlocations per instruction may be identified, including up to two sourceoperand identifiers 364 and 365. For one embodiment of the shift mergeinstruction, destination operand identifier 366 is the same as sourceoperand identifier 364. For an alternative embodiment, destinationoperand identifier 366 is the same as source operand identifier 365.Therefore, for embodiments of a shift merge operation, one of the sourceoperands identified by source operand identifiers 364 and 365 isoverwritten by the results of the shift merge operations. For oneembodiment of the shift merge instruction, operand identifiers 364 and365 may be used to identify 64-bit source and destination operands.

FIG. 3D is a depiction of another alternative operation encoding(opcode) format 370, having forty or more bits. Opcode format 370corresponds with opcode format 360 and comprises an optional prefix byte378. The type of shift right merge operation, may be encoded by one ormore of fields 378, 371, and 372. Up to two operand locations perinstruction may be identified by source operand identifiers 374 and 375and by prefix byte 378. For one embodiment of the merge instruction,prefix byte 378 may be used to identify 128-bit source and destinationoperands. For one embodiment of the shift merge instruction, destinationoperand identifier 376 is the same as source operand identifier 374. Foran alternative embodiment, destination operand identifier 376 is thesame as source operand identifier 375. Therefore, for embodiments of theshift merge operations, one of the source operands identified by sourceoperand identifiers 374 and 375 is overwritten by the results of theshift merge operations. Opcode formats 360 and 370 allow register toregister, memory to register, register by memory, register by register,register by immediate, register to memory addressing specified in partby MOD fields 363 and 373 and by optional scale-index-base anddisplacement bytes.

Turning next to FIG. 3E, in some alternative embodiments, 64 bit singleinstruction multiple data (SIMD) arithmetic operations may be performedthrough a coprocessor data processing (CDP) instruction. Operationencoding (opcode) format 380 depicts one such CDP instruction having CDPopcode fields 382 and 389. The type of CDP instruction, for alternativeembodiments of shift merge operations, may be encoded by one or more offields 383, 384, 387, and 388. Up to three operand locations perinstruction may be identified, including up to two source operandidentifiers 385 and 390 and one destination operand identifier 386. Oneembodiment of the coprocessor can operate on 8, 16, 32, and 64 bitvalues. For one embodiment, the merge operation is performed onfixed-point or integer data elements. In some embodiments, a mergeinstruction may be executed conditionally, using condition field 381.For some merge instructions source data sizes may be encoded by field383. In some embodiments of a shift merge instruction, Zero (Z),negative (N), carry (C), and overflow (V) detection can be done on SIMDfields. For some instructions, the type of saturation may be encoded byfield 384.

In the examples of the following figures, a number of data operands aredescribed. For simplicity, the data segments are labeled from letter Aonwards alphabetically, wherein A is located at the lowest address and Zwould be located at the highest address. Thus, A may be at address 0, Bat address 1, C at address 3, and so on. Although the data sequences insome of the examples appear with the letters arranged in reversealphabetic order, the addressing would still start with A at 0, B at 1,etc. Conceptually, a shift right operation, as in the shift right mergefor one embodiment, entails right shifting the lower address datasegments out if the sequence is D, C, B, A. Thus, a right shift simplyshifts the data elements of a data block to the right past a stationaryline. Furthermore, a shift right merge operation can conceptually rightshift the rightmost data segments from one operand into the left side ofanother data operand as if the two operands were on a continuum.

FIG. 4A is a block diagram of one embodiment of logic to perform a SIMDparallel shift merge operation on data operands in accordance with thepresent invention. The PSRMRG instruction for a shift right merge (also,a register shift) operation of this embodiment begins with three piecesof information: a first data operand 402, a second data operand 404, anda shift count 406. In one embodiment, the PSRMRG shift merge instructionis decoded into one micro-operation. In an alternate embodiment, theinstruction may be decoded into a various number of micro-ops to performthe shift merge operation on the data operands. For this example, thedata operands 402, 404, are 64 bit wide pieces of data stored in aregister/memory and the shift count 406 is an 8 bit wide immediatevalue. Depending on the particular implementation, the data operands andshift count can be other widths such as 128/256 bits and 16 bits,respectively. The first operand 402 in this example is comprised ofeight data segments: P, O, N, M, L, K, J, and I. The second operand 404is also comprised of eight data segments: H, G, F, E, D, C, B, and A.The data segments here are of equal length and each comprise of a singlebyte (8 bits) of data. However, another embodiment of the presentinvention operates with longer 128 bit operands wherein the datasegments are comprised of a single byte (8 bits) each and the 128 bitwide operand would have sixteen byte wide data segments. Similarly, ifeach data segment was a double word (32 bits) or a quad word (64 bits),the 128 bit operand would have four double word wide or two quad wordwide data segments, respectively. Thus embodiments of the presentinvention are not restricted to particular length data operands, datasegments, or shift counts, and can be sized appropriately for eachimplementation.

The operands 402, 404 can reside either in a register or a memorylocation or a register file or a mix. The data operands 402, 404, andthe count 406 are sent to an execution unit 410 in the processor alongwith a shift right merge instruction. By the time the shift right mergeinstruction reaches the execution unit 410, the instruction should havebeen decoded earlier in the processor pipeline. Thus the shift rightmerge instruction can be in the form of a micro operation (uop) or someother decoded format. For this embodiment, the two data operands 402,404, are received at concatenate logic and a temporary register. Theconcatenate logic merges/joins the data segments for the two operandsand places the new block of data in a temporary register. Here, the newdata block is comprised of sixteen data segments: P, O, N, M, L, K, J,I, H, G, F, E, D, C, B, A. As this example is working with 64 bits wideoperands, the temporary register need to hold the combined data is 128bits wide. For 128 bits wide data operands, a 256 bits wide temporaryregister is needed.

Right shift logic 414 in the execution unit 410 takes the contents ofthe temporary register and performs a logical shift right of the datablock by n data segments as requested by the count 406. In thisembodiment, the count 406 indicates the number of bytes to right shift.Depending on the particular implementation, the count 406 can also beused to indicated the number of bits, nibbles, words, double words, quadwords, etc. to shift, depending on the granularity of the data segments.For this example, n is equal to 3, so the temporary register contentsare shifted by three bytes. If each data segment was a word or doubleword wide, then the count can indicate the number of words or doublewords to shift, respectively. For this embodiment, 0's are shifted infrom the left side of the temporary register to fill up the vacatedspaces as the data in the register is shifted right. Thus if the shiftcount 406 is greater than the number of data segments in a data operand(eight in this case), one or more 0's can appear in the resultant 408.Furthermore, if the shift count 406 is equal to or exceeds the totalnumber of data segments for both operands, the resultant will compriseof all 0's, as all the data segments will have been shifted away. Theright shift logic 414 outputs the appropriate number of data segmentsfrom the temporary register as the resultant 408. In another embodiment,an output multiplexer or latch can be included after the right shiftlogic to output the resultant. For this example, the resultant is 64bits wide and includes eight bytes. Due to the shift right mergeoperation on the two data operands 402, 404, the resultant is comprisedof the following eight data segments: K, J, I, H, G, F, E, and D.

FIG. 4B is a block diagram of another embodiment of logic to perform ashift right merge operation. Like the previous example of FIG. 4A, theshift right merge operation of this embodiment begins with three piecesof information: a first 64 bits wide data operand 402, a second 64 bitswide data operand 404, and a 8 bits wide shift count 406. The shiftcount 406 indicates how many places to shift the data segments. For thisembodiment, the count 406 is stated in number of bytes. In an alternateembodiment, the count may indicate the number of bits, nibbles, words,double words, or quad words to shift the data. The first and secondoperands 402 in this example are each comprised of eight equal length,byte size data segments (H, G, F, E, D, C, B, A) and the second operand404 is comprised of eight data segments (P, O, N, M, L, K, J, I). Thecount n is equal to 3. Another embodiment of the invention can operatewith alternative length operands and data segments, such as 128/256/512bits wide operands and bit/byte/word/double word/quad word sized datasegments and 8/16/32 bits wide shift counts. Thus embodiments of thepresent invention are not restricted to particular length data operands,data segments, or shift counts, and can be sized appropriately for eachimplementation.

The data operands 402, 404, and the count 406 are sent to an executionunit 420 in the processor along with a shift right merge instruction.For this embodiment, the first data operand 402 and the second dataoperand 404 are received at shift left logic 422 and shift right logic424, respectively. The count 406 is also sent to the shift logic 422,424. The shift left logic 422 shifts data segments for the first operand402 left by the “number of data segments in the first operand−n” numberof segments. As the data segments are shifted left, 0's are shifted infrom the right side to fill up the vacated spaces. In this case, thereare eight data segments, so the first operand 402 is shifted left byeight minus three, or five, places. The first operand 402 is shifted bythis different value to achieve the correct data alignment for mergingat the logical OR gate 426. After the left shift here, the first dataoperand becomes: K, J, I, 0, 0, 0, 0, 0. If the count 406 is greaterthan the number of number of data segments in the operand, the shiftleft calculation can yield a negative number, indicating a negative leftshift. A logical left shift with a negative count is interpreted as ashift in the negative direction and is essentially a logical rightshift. A negative left shift will bring in 0's from the left side of thefirst operand 402.

Similarly, the shift right logic 424 shifts data segments for the secondoperand right by n number of segments. As the data segments are shiftedright, 0's are shifted in from the left side to fill up the vacatedspaces. The second data operand becomes: 0, 0, 0, H, G, F, E, D. Theshifted operands are outputted from the shift left/right logic 422, 424,and merged together at the logical OR gate 426. The OR gate performs alogical or-ing of the data segments and provides a 64 bits wideresultant 408 of this embodiment. The or-ing together of “K, J, I, 0, 0,0, 0, 0” with “0, 0, 0, H, G, F, E, D” generates a resultant 408comprising eight bytes: K, J, I, H, G, F, E, D. This result is the sameas that for the first embodiment of the present invention in FIG. 4A.Note that for a count n 406 greater than the number of data elements inan operand, the appropriate number of 0's can appear in the resultantstarting on the left side. Furthermore, if the count 406 is greater thanor equal to the total number of data elements in both operands, theresultant will comprise of all 0's.

FIG. 5A illustrates the operation of a parallel shift merge instructionin accordance with a first embodiment of the present invention. Forthese discussions, MM1 504, MM2 506, TEMP 532, and DEST 542, aregenerally referred to as operands or data blocks, but are not restrictedas such and also include registers, register files, and memorylocations. In one embodiment MM1 504 and MM2 506 are 64 bits wide MMXregisters (also referred to as ‘mm’ in some instances). At the state1500, a shift count imm[y] 502, a first operand MM1[x] 504, and a secondoperand MM2[x] 506 are sent with the parallel shift right mergeinstruction. The count 502 is an immediate value of y bits width. Thefirst 504 and second 506 operands are data blocks including x datasegments and having total widths of 8x bits each if each data segment isa byte (8 bits). The first 504 and second 506 operands are each packedwith a number of smaller data segments. For this example, the first dataoperand MM1 504 is comprised of eight equal length data segments: P 511,O 512, N 513, M 514, L 515, K 516, J 517, I 518. Similarly, the seconddata operand MM2 506 is comprised of eight equal length data segments: H521, G 522, F 523, E 524, D 1225, C 526, B 527, A 528. Thus each ofthese data segments are ‘x*8’ bits wide. So if x is 8, each operand is 8bytes or 64 bits wide. For other embodiments, a data element can be anibble (4 bits), word (16 bits), double word (32 bits), quad word (64bits), etc. In alternate embodiments, x can be 16, 32, 64, etc. dataelements wide. The count y is equal to 8 for this embodiment and theimmediate can be represented as a byte. For alternate embodiments, y canbe 4, 16, 32, etc. bits wide. Furthermore, the count 502 is not limitedto an immediate value and can also be stored in a register or memorylocation.

The operands MM1 504 and MM2 506 are merged together at state 11530 toform a temporary data block TEMP[2x] 532 of 2x data elements (or bytesin this case) wide. The merged data 532 of this example is comprised ofsixteen data segments arranged as: P, O, N, M, L, K, J, I, H, G, F, E,D, C, B, and A. An eight byte wide window 534 frames eight data segmentsof the temporary data block 532, starting from the rightmost edge. Thusthe right edge of the window 534 would line up with the right edge ofthe data block 532 such that the window 534 frames data segments: H, G,F, E, D, C, B, and A. The shift count n 502 indicates the desired amountto right shift the merged data. The count value can be implemented tostate the shift amount in terms of bits, nibbles, bytes, words, doublewords, quad words, etc., or particular number of data segments. Based onthe count value 502, the data block 532 is shifted right 536 by n datasegments here. For this example, n is equal to 3 and the data block 532is slid three places to the right. Another way of looking at this is toshift the window 534 in the opposite direction. In other words, thewindow 534 can be conceptually viewed as shifting three places to theleft from the right edge of the temporary data block 532. For oneembodiment, if the shift count n is greater than the total number ofdata segments, 2x, present in the combined data block, the resultantwould comprise of all ‘0’s. Similarly, if the shift count n is greaterthan or equal to the number data segments, x, in an the first operand504, the resultant would include one or more ‘0’s starting from the leftside of the resultant. At state III 540, the data segments (K, J, I, H,G, F, E, D) framed by the window 534 is outputted as a resultant to an xdata elements wide destination DEST[x] 542.

FIG. 5B illustrates the operation of a shift right merge instruction inaccordance with a second embodiment. The shift right merge instructionis accompanied at state 1550 by a count imm[y] of y bits, a first dataoperand MM1[x] of x data segments, and as second data operand MM2[x] ofx data segments. As with the example of the FIG. 5A, y is equal to 8 andx is equal to 8, wherein MM1 and MM2 each being 64 bits or 8 bytes wide.The first 504 and second 506 of this embodiment are packed with a numberof equally sized data segments, each a byte wide in this case, “P 511, O512, N 513, M 514, L 515, K 516, J 517, I 518” and H 521, G 522, F 523,E 524, D 525, C 526, B 1227, A 528″, respectively.

At state II 560, the shift count n 502 is used to shift the first 504and second 506 operands. The count of this embodiment indicates thenumber of data segments to right shift the merged data. For thisembodiment, the shifting occurs before the merging of the first 504 andsecond 506 operands. As a result, the first operand 504 is shifteddifferently. In this example, the first operand 504 is shifted left by xminus n data segments. The “x−n” calculation allows for proper dataalignment at later data merging. Thus for a count n of 3, the firstoperand 504 is shifted to the left by five data segments or five bytes.There are 0's shifted in from the right side to fill the vacated spaces.But if shift count n 502 is greater than the number of number of datasegments x available in first operand 504, the shift left calculation of“x−n” can yield a negative number, which in essence indicates a negativeleft shift. In one embodiment, a logical left shift with a negativecount is interpreted as a left shift in the negative direction and isessentially a logical right shift. A negative left shift will bring in0's from the left side of the first operand 504. Similarly, the secondoperand 506 is shifted right by the shift count of 3 and 0's are shiftedin from the left side to fill the vacancies. The shifted results areheld for the first 504 and second 506 operands are stored in x datasegments wide registers TEMP1 566 and TEMP2 568, respectively. Theshifted results from TEMP1 566 and TEMP2 568 are merged together 572 togenerate the desired shift merged data at register DEST 542 at state III570. If shift count n 502 is greater than x, the operand can contain oneor more 0's in the resultant from the left side. Furthermore, if shiftcount n 502 is equal to 2x or greater, the resultant in DEST 542 willcomprise of all 0's.

In the above examples, such as in FIGS. 5A and 5B, one or both MM1 andMM2 can be 64 bits data registers in a processor enabled with MMX/SSEtechnology or 128 bits data registers with SSE2 technology. Depending onthe implementation, these registers can be 64/128/256 bits wide.Similarly, one or both of MM1 and MM2 can be memory locations other thana register. In the processor architecture of one embodiment, MM1 and MM2are source operands to a shift right merge instruction (PSRMRG) asdescribed above. The shift count IMM is also an immediate to such aPSRMRG instruction. For one embodiment, the destination for theresultant, DEST, is also a MMX or XMM data register. Furthermore, DESTmay be the same register as one of the source operands. For instance, inone architecture, a PSRMRG instruction has a first source operand MM1and a second source operand MM2. The predefined destination for theresultant can be the register for the first source operand, MM1 in thiscase.

FIG. 6A is a flowchart illustrating one embodiment of a method to shiftand merge data operands. The length values of L is generally used hereto represent the width of the operands and data blocks. Depending on theparticular embodiment, L can be used to designate the width in terms ofnumber of data segments, bits, bytes, words, etc. At block 602, a firstlength L data operand is received for use with the execution of a shiftmerge operation. A second length L data operand for the shift mergeoperation is also received at block 604. A shift count to indicated howmany data segments or distance, in bits/nibbles/bytes/words/doublewords/quad words, is received at block 606. Execution logic at block 608concatenates the first operand and the second operand together. For oneembodiment, a temporary length 2L register holds the concatenated datablock. In an alternated embodiment, the merged data is held in a memorylocation. At block 610, the concatenated data block is shifted right bythe shift count. If the count is expressed as a data segment count, thenthe data block is shifted right by that many data segments and 0's areshifted in from the left along the most significant end of the datablock to fill the vacancies. If the count is expressed in bits or bytes,for example, the data block is similarly right shifted by that distance.At block 612, a length L resultant is generated from the right hand sideor least significant end of the shifted data block. For one embodiment,the length L amount of data segments are muxed from the shifted datablock to a destination register or memory location.

FIG. 6B is a flowchart illustrating another embodiment of a method toshift right and merge data. A first length L data operand is receivedfor processing with a shift right and merge operation at block 652. Asecond length L data operand is received at block 654. At block 656, ashift count to indicate the desired right shift distance. The first dataoperand is shifted left at block 658 based on a calculation with theshift count. The calculation of one embodiment comprises subtracting theshift count from L. For instance, if operand length L and shift countare in terms of data segments, then the first operand is shifted left by“L−shift count” segments, with 0's shifting in from the leastsignificant end of the operand. Similarly, if L is expressed in bits andthe count is in bytes, the first operand would be shifted left by“L−shift count*8” bits. The second data operand is shifted right atblock 660 by the shift count and 0's shifted in from the mostsignificant end of the second operand to fill vacancies. At block 662,the shifted first operand and the shifted second operand are mergedtogether to generate a length L resultant. For one embodiment, themerging yields a result comprising the desired data segments from boththe first and second operands.

One increasingly popular use for computers involves manipulation ofextremely large video and audio files. Even though these video and audioare typically transferred via very high bandwidth networks or highcapacity storage media, data compression is still necessary in order tohandle the traffic. As a result, different compression algorithms arebecoming important parts of the representation or coding scheme for manypopular audio, image, and video formats. Video in accordance with one ofthe Motion Picture Expert Group (MPEG) standards is one application thatuses compression.

For one embodiment, a predetermined amount of data is loaded from abitstream into a temporary bitstream buffer. This implementation isenabled to track the number of remaining data bits in the temporarybuffer and to check whether enough bits remain to extract anothersymbol. If an insufficient number of unprocessed bits remain, meaningnot all the requisite bits for the present symbol being extracted havebeen loaded, the bitstream buffer is refilled with additional data bitsfrom the bitstream. The algorithm of this embodiment employs a shiftmerge instruction to create a new block of data based on the remainingbits in the temporary buffer and on bitstream data. The pointer to thecurrent bitstream position is also adjusted to account for the dataload. Similarly, the bit count for the temporary buffer is also updatedto reflect the total number of data bits now present. During the symbolextraction for one embodiment, an individual symbol is graduallyextracted from the temporary bitstream buffer and unnecessary data bitson the leading edge of the data block are shifted out. In thisembodiment, the associated bits for each decoding symbol are moved fromthe temporary buffer to a general purpose register. One embodiment ofthe present invention can be included with MPEG-2 VLD code.

FIGS. 7A-B illustrate the extraction of symbols having varying bitgranularity from a bitstream. FIG. 7A illustrates a scenario for abitstream buffer manipulation with a SIM shift merge instruction inaccordance with one embodiment of the present invention where asufficient number of unprocessed data bits from the bitstream areavailable in the temporary bitstream buffer. In this embodiment,multimedia data for an audio and/or video is communicated along a databitstream 710. Depending on the particular implementation, bitstream 710can be a live stream of data or a stream of data presently locatedwithin memory. The portion of bitstream 710 in this example includesdata blocks A 711, B 712, C 713, and D 714. Although a limited number ofdata blocks are shown for the bitstream 710, the bitstream can beconsidered as having a plurality of additional other data blocks ortreated as a long stream of data being fed from a source. The datablocks here can be of any predetermined size. For one embodiment, eachdata block is a doubleword wide. Data is loaded 715 from the bitstream710 to a temporary bitstream buffer 720. This temporary buffer 720 canbe a memory location or a register, such as a 64-bit MMX register or a128-bit XMM register. For this example, the buffer 720 is a 64-bit SIMDregister that can hold two data blocks worth of bitstream data. Data forthe two data blocks A 711 and B 712 are shown loaded 715 into buffer720.

The contents of the temporary buffer 720 as shown in FIG. 7A includesthree complete symbols (E1 721, E2 722, E3 723) and a portion of anothersymbol (E4 a 724). Note that these symbols are of varying length. SymbolE1 721 is comprised of x-bits, symbol E2 722 is comprised of y-bits, andsymbol E3 723 is comprised of z-bits. For one embodiment, the algorithmtracks the number of bits that are processed from the buffer 720 foreach symbol is extracted and also keeps a tally of the remaining numberof unprocessed bits remaining in the buffer 720. During the symbolextraction algorithm, each symbol is copied or shifted from thetemporary buffer 720 into a destination such as a general purposeregister. The general purpose registers 734, 735, 736, here are ofsmaller size than the buffer 720 and can be used to further manipulatethe extracted symbols. However, as the symbol size can vary, not all thebits in a register may be needed and certain unused bits can be zeroedor ignored. These unused bit locations are illustrated as cross hatchingin registers 734, 735, 736. In this embodiment, all of the symbols thathave all its respective bits from the bitstream 710 present in thetemporary buffer 720, are extracted out. Thus the x-bits of symbol E1721 are extracted 731 to a first register 734, the y-bits of symbol E2722 are extracted 732 to a second register 735, and the z-bits of symbolE3 723 are extracted 733 to a third register 736. As for the symbol E4 a724 that does not have all its needed bits available from the bitstream720 in the temporary buffer 720, that symbol can not be extracted justyet. Additional data bits have to be loaded from bitstream 720 into thebuffer 720 and merged with the remaining unprocessed bits, the partialsymbol bits for E4 a 724 in this case.

FIG. 7B further illustrates the related scenario from FIG. 7A formanipulating a bitstream buffer in accordance with one embodiment of thepresent invention wherein an insufficient number of unprocessed databits from the bitstream are available in the temporary bitstream buffer.Here, an additional thirty two bits for the next data block C 713 in thebitstream 710 have to be loaded and merged with the remainingunprocessed bits for E4 a 724 that already reside in the temporarybitstream buffer 720. Like elements from FIG. 7A are similarly labeledin FIG. 7B. As from above, symbols E1 721, E2 722, and E3 723 that werelocated in data blocks A 711 and B 712 are extracted from the temporarybitstream buffer 720. An examination of C 713 of this example can showthat partial symbol E4 b 726 having e-bits and other bits of othersymbols, such as symbol E5 727, are located within the block 713. Inthis example, E5 727 happens to fall on a 32 bit boundary. Although thedata block C 713 as shown in this instance appears less than a fullregister length of data, the amount of data loaded from the bitstream toa register in performing a merge operation can vary based on the amountof data needed. In one embodiment, a sufficient amount of data is loadedfrom the bitstream 710 each time to fill a register.

Partial symbols E4 a 724 and E4 b 726 together form a complete symbol E4746. In order to correctly extract the symbol E4 724, the partial bitsfrom E4 a 724 and E4 b 726 have to be properly joined together. The useof a shift merge operation 740 allows for the merging of blocks of datafrom temporary buffer 720 and block C 713 of bitstream 710. In thisembodiment, the shift merge operation is performed at a byte granularityalong byte boundaries. For the example of FIG. 7B, the shift count isfour because data block C 713 is a doubleword, or four bytes, in length.Thus, a doubleword containing E4 a 724 is shifted 741 and merged 743,with the doubleword that includes E4 b 726 into a temporary bitstreambuffer 744. For one embodiment, buffers 720 and 744 can be the samebuffer. Note that the shift merge operation 740 caused the doubleword B712 from buffer 720 to shift to the upper portion of the destinationbuffer 744 and doubleword C 713 was shifted into the lower portion,while the two portions were properly merged together at the middle.

The contents of this temporary buffer 744 includes ‘do not care’ bits745, the now complete symbol E4 746, and other symbols, such as symbolE5 727. In this example, the ‘do not care’ bits 745 can include parts orall of E2 722 or E3 723, depending on where the merge occurs. Symbol E4746 is comprised of g-bits and E5 727 is comprised of f-bits. In thisexample, g of E4 746 is equal to the sum of d and e for E4 a 724 and E4b 726, respectively. The variable length decoding algorithm extracts thecomplete symbols from buffer 744. Thus the g-bits of merged symbol E4746 are extracted 747 to a fourth register 749 and the f-bits of symbolE5 727 are extracted 748 to a fifth register 750. Depending on thesymbol size, not all of the bits in a register may needed. Unused bitlocations are shown in cross hatch in registers 749, 750.

Although a plurality of the symbols in FIGS. 7A-B, such as E1 721, werebyte aligned, a number, such as E 2 722 and E3 733, are not.Furthermore, the bit granularity of the symbol length can cause symbolboundaries to exist at inconvenient places. Whereas byte boundaries canbe easily handled, data not byte aligned may not be as easily handledwithout a shift merge type of operation to synchronize and merge brokenup symbols such as E4 746. Depending on the particular embodiment,additional features can be implemented to further enhance performance.For instance, the shift merge instruction and the shift merge operationas described in the examples above can also be implemented with bitgranularity. Thus the shift merge operation can better focus on the bitsof interest when loading data from the bitstream, instead of having tooperate at byte aligned boundaries. Similarly, a shift merge instructioncan be tuned to operate specifically with four or six byte operands atpredetermined memory address boundaries to minimize the addresscalculations for memory loads during the data merge. For instance, afour byte operand shift merge instruction could be used in the exampleFIG. 7B as the blocks of data from the bitstream 710 are a doubleword inlength.

FIGS. 8A-C are flowcharts illustrating one embodiment of a method tomanipulate a bitstream buffer with a SIMD merge instruction. Theflowchart 810 at FIG. 8A illustrates a first portion of the algorithmfor one embodiment. At block 812, a bitstream of data is received. Ablock of data is loaded from the bitstream at block 814. Depending onthe implementation, the bitstream can be located in a type of memory.The number of data blocks that can be loaded can vary based on the sizeof the temporary buffer used to hold data bits for processing and symbolextraction. At block 820, a symbol is read out from the loaded data. Forthis embodiment, each symbol read out is complete in terms of its databits and the symbol is sent to a register for further processing or use.A check is made at block 822 as to whether any more unprocessed databits are left in the buffer.

If the determination at block 822 is that no unprocessed bits are left,the flow proceeds to tab A 824 of the flowchart 830 in FIG. 8B. Tab A824 leads to block 832, where a check is made as to whether more data isavailable in the bitstream. If no more bitstream data is present forprocessing, the algorithm is done. But if the determination is that morebitstream data is available at block 832, the next block of data isloaded at block 834 for processing. In this instance, because noresidual unprocessed bits were left in the buffer from the previouslyloaded data, a shift merge is not needed and the newly loaded data canbe operated on. The flow proceeds to tab C 816, which jumps back toreading out a symbol from the buffer at block 820. Thus the variablelength decoding to extract symbols continues.

If the determination at block 822 is that unprocessed bits areavailable, the flow proceeds to tab B 826 of the flowchart 840 in FIG.8C. Tab B 825 lead to block 840, where a check is made as to whether awhole symbol is present within the unprocessed bits. If a whole symbolis present at block 840, the flow proceeds to tab D 818, which jumpsback to reading out a symbol from the buffer at block 820. Thus thesymbol extraction can continue on the presently loaded data. But if thedetermination at block 840 is that no whole symbol is present in theloaded data, a check is made at block 842 as to whether a partial pieceof a symbol is located within the unprocessed bits. If the finding atblock 842 is that no partial piece of a symbol is present in theunprocessed bits, meaning that the remaining bits may be invalid orunrecognized, the flow proceeds to tab E 846. Tab 846 leads back toblock 832 to determine if more data is available in the bitstream andthe decoding/extraction algorithm continues. If the finding at block 842is that a partial symbol is present in the unprocessed bits, the nextdata block is loaded and these remaining unprocessed bits are mergedwith that data block. The flow continues back to tab D 818, which readsout a next symbol from the merged symbol data at block 820. For thissituation, the next symbol at block 820 is the merged result of thepartial symbol bits from block 842 and the corresponding partial symbolbits that were loaded with the bitstream data from block 844. The symbolextraction algorithm continues from block 820.

Thus, techniques for a method for bitstream buffer manipulation with aSIMD merge instruction are disclosed. While certain exemplaryembodiments have been described and shown in the accompanying drawings,it is to be understood that such embodiments are merely illustrative ofand not restrictive on the broad invention, and that this invention notbe limited to the specific constructions and arrangements shown anddescribed, since various other modifications may occur to thoseordinarily skilled in the art upon studying this disclosure. In an areaof technology such as this, where growth is fast and furtheradvancements are not easily foreseen, the disclosed embodiments may bereadily modifiable in arrangement and detail as facilitated by enablingtechnological advancements without departing from the principles of thepresent disclosure or the scope of the accompanying claims.

What is claimed is:
 1. A system on a chip comprising: a memory; a memorycontroller coupled with the memory; a graphics controller; and aplurality of processors, one of the processors comprising: a pluralityof registers; a cache; an instruction decoder to decode a shift rightmerge instruction indicating a first 32-bit source operand and a second32-bit source operand, the first 32-bit source operand including a firstfour 8-bit byte data elements, the second 32-bit source operandincluding a second four 8-bit byte data elements, wherein the 8-bit bytedata elements are integers; and an execution unit that is part of adigital signal processor coupled with the instruction decoder and theplurality, of registers, the execution unit in response to the shiftright merge instruction to: shift the second 32-bit source operand rightby one byte, wherein the one byte amount to shift the second 32-bitsource operand right by is fixed for a type of the shift right mergeinstruction; merge a least significant 8-bit byte data element of thefirst 32-bit source operand into a most significant byte position of theshifted second 32-bit source operand to generate a result; and store theresult in a 32-bit destination indicated by the shift right mergeinstruction, wherein the system on the chip implements a combination ofinstruction sets including a very long instruction word (VLIW)instruction set that includes the shift right merge instruction.
 2. Thesystem on the chip of claim
 1. wherein the execution unit, in responseto the shift right merge instruction, is to shift the first 32-bitsource operand left by three bytes.
 3. The system on the chip ofclaim
 1. wherein the execution unit, in response to the shift rightmerge instruction, is to concatenate the first and second 32-bit sourceoperands.
 4. The system on the chip of claim 1, wherein the resultincludes a most significant three of the second four 8-bit byte dataelements of the second 32-bit source operand in a least significantportion of the result.
 5. The system on the chip of claim 1, implementedin a cellular phone comprising a wireless transceiver, a keyboardinterface, and a Universal Serial Bus.
 6. A system on a chip comprising:an on-die memory; an on-die memory controller; an on-die graphicscontroller; and a plurality of processors, one of the processorscomprising: a plurality of registers, wherein the plurality of registersare to store packed data; a cache; an instruction fetch unit to fetch ashift right merge instruction; an instruction decoder to decode theshift right merge instruction, the shift right merge instructionindicating a first 32-bit source operand in a register of the pluralityand a second 32-bit source operand in a register of the plurality, thefirst 32-bit source operand including a first four packed 8-bit byteinteger data elements, the second 32-bit source operand including asecond four packed 8-bit byte data elements, wherein the shift rightmerge instruction has a 32-bit instruction format; and an execution unitof a digital signal processor, the execution unit coupled with theinstruction decoder and the plurality of registers, the execution unitin response to the shift right merge instruction to: shift the second32-bit source operand right by one byte, wherein the one byte rightshift of the second 32-bit source operand is fixed for a type of theshift right merge instruction; merge a least significant 8-bit byte dataelement of the first 32-bit source operand into a most significant byteposition of a result that also includes, in a least significant portionthereof, three shifted 8-bit byte data elements of the second 32-bitsource operand; and store the result in a 32-bit destination indicatedby the shift right merge instruction, wherein the destination is aregister of the plurality, wherein the system on the chip implements acombination of instruction sets, and wherein the shift right mergeinstruction is included in a very long instruction word (VLIW)instruction set.
 7. The processor system on the chip of claim 6, whereinthe three shifted 8-bit byte data elements of the second 32-bit sourceoperand are a most significant three of the second four 8-bit byte dataelements of the second 32-bit source operand.
 8. The system on the chipof claim 6, wherein the three shifted 8-bit byte data elements of thesecond 32-bit source operand are a most significant three of the secondfour 8-bit byte data elements of the second 32-bit source operand. 9.The system on the chip of claim 6, implemented in a cellular phonecomprising a wireless transceiver.
 10. A system comprising: a memory; awireless transceiver; a keyboard interface; and a system on a chipcoupled with the memory, the wireless transceiver, and the keyboardinterface, the system on the chip comprising: an on-die memory; anon-die memory controller; an on-die graphics controller a cache; aplurality of processors, at least one of the processors including: aplurality of registers; an instruction decoder to decode a shift rightmerge instruction indicating a first 32-bit source operand and a second32-bit source operand, the first 32-bit source operand including a firstfour packed 8-bit byte integer data elements, the second 32-bit sourceoperand including a second four packed 8-bit byte integer data elements;and an execution unit that is part of a digital signal processor coupledwith the instruction decoder and the plurality of registers, theexecution unit in response to the shift right merge instruction to:shift the second 32-bit source operand right by one byte; merge a leastsignificant 8-bit byte data element of the first 32-bit source operandinto a most significant byte position of the shifted second 32-bitsource operand to generate a result; and store the result in a 32-bitdestination indicated by the shift right merge instruction, wherein thesystem comprises a cellular phone, wherein the shift right mergeinstruction does not indicate an immediate, and wherein the processorimplements a combination of instruction sets, and wherein the shiftright merge instruction is of a very long instruction word (VLIW)instruction set.
 11. The system on the chip of claim 1, wherein thecombination of the instruction sets includes a reduced instruction setcomputing (RISC) instruction set.
 12. The system on the chip of claim 6,wherein the combination of the instruction sets includes a reducedinstruction set computing (RISC) instruction set.
 13. The system ofclaim 10, wherein the combination of the instruction sets includes areduced instruction set computing (RISC) instruction set.